Skip to content

Add Align cylinders tool for shaft-into-hole placement - #240

Merged
trailcode merged 2 commits into
mainfrom
Trailcode/shp-cyl-align
Aug 1, 2026
Merged

Add Align cylinders tool for shaft-into-hole placement#240
trailcode merged 2 commits into
mainfrom
Trailcode/shp-cyl-align

Conversation

@trailcode

@trailcode trailcode commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add Align cylinders (Mode::Shape_cyl_align, default J / mode.cyl_align): pick two cylindrical faces (first moves), coaxially align, drag insert depth along the shared axis, then bake like Move/Rotate.
  • Geometry helpers cylinder_from_face and cyl_align_trsf in utl_geom; new Shp_cyl_align op with Options Flip direction and radius-mismatch log warning.
  • Docs: usage.md, shape.md, gui.md, CHANGELOG [Unreleased]; hotkey default in res/ezycad_settings.json.

Closes #239

Test plan

  • Desktop Release build of EzyCad
  • Manual: add cylinder (rod) + body with hole of same diameter; J → pick rod face → pick hole face → drag depth → LMB/Enter bake; undo/redo
  • Manual: pick hole first to move hole onto rod; Options Flip direction; Tab depth entry; Esc cancel during pick and during drag
  • Manual: planar end face → "not cylindrical"; empty click → solid/face prompt; remappable hotkey in Settings
  • Docs: Align cylinders section + Modeling hotkeys row; toolbar tooltip shows J

Note

Medium Risk
New interactive transform that permanently changes solid geometry and frame/undo state; logic depends on cylindrical face detection and alignment math, but it follows the same patterns as existing move/rotate tools.

Overview
Adds Align cylinders (Mode::Shape_cyl_align, default J / mode.cyl_align): a one-shot transform for placing a shaft in a hole by picking two cylindrical faces, coaxially aligning the first body to the second, then dragging or Tab-typing insert depth along the shared axis. Flip direction in Options reverses axis sense; mismatched radii log a warning but still allow placement. Finalize bakes geometry like Move/Rotate via Shape_geom_delta undo.

New Shp_cyl_align and utl_geom helpers (cylinder_from_face, cyl_align_trsf) implement face detection and rigid alignment. GUI wiring covers toolbar, hotkeys, face selection mode, LMB pick/finalize, depth drag, Esc cancel, and undo history treats the mode like other interactive transforms. Occt_view::set_dynamic_highlight_enabled is exposed and turned off during depth drag to avoid stale hover highlights.

User docs (usage.md, shape.md, gui.md, CHANGELOG) and default gui.hotkeys are updated. Minor unrelated cleanup: main.cpp Python queue brace formatting.

Reviewed by Cursor Bugbot for commit 2336222. Bugbot is set up for automated code reviews on this repo. Configure here.

Trailcode added 2 commits August 1, 2026 17:16
@trailcode
trailcode merged commit bca301b into main Aug 1, 2026
4 checks passed
@trailcode
trailcode deleted the Trailcode/shp-cyl-align branch August 1, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Align cylinders tool for shaft-into-hole placement

1 participant